﻿<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>生产作业平衡</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="/InSiteWebApplication/Content/AnyGantt/css/anychart-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="/InSiteWebApplication/Content/AnyGantt/fonts/css/anychart-font.min.css" />
    <style>
        .datagrid-cell{padding:0}
        #ApsTestlayout .panel-header{padding:0}
        #ApsTestlayout .panel-title{height: 24px;line-height: 24px;}
        #ApsTestlayout .datagrid-body:nth-child(1n){margin-top:-1px}
      
        #center .datagrid-header span {font-size: 18px !important;}
        #EQULIST .equ {margin-bottom: 10px;height:80px;width:99%;border: 1px solid #ddd;border-radius: 5px}
        .datagrid-body::-webkit-scrollbar{width:0px;height:8px;}
        .datagrid-body::-webkit-scrollbar-thumb {background:rgba(0,0,0,0.2);border-radius:4px;}
        
          .l-btn2
{
border: #d2d2d2 1px solid;
FONT-FAMILY: Tahoma, Helvetica; 
FONT-SIZE: 10px; 
CURSOR: hand; FONT-WEIGHT: 500;TEXT-DECORATION: none; 
cursor:pointer;
height:26px;
color:#fff;
background:#02bfbf;
}
.l-btn2:hover
{ color:#fff;
   background:#05d2d2;
    }
    </style>
</head>
<body>
    <div class="panelSection">    
        <div class="easyui-panel " title="查询区域" style="padding:3px;width: 100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
           <form id="searchForm" method="post">
	    	<table>
                <tr>
                    <td>单元 :</td>
                    <td><input id="Text1" name="Factory" class="easyui-combobox" style="width: 120px; height: 22px" data-options='editable:false'/></td>
                    <td>平衡月份:</td>
                    <td><input id="Text2" name="Factory" class="easyui-combobox" style="width: 120px; height: 22px" data-options='editable:false'/></td>
                    <td>是否已排:</td>
                    <td><input id="Text3" name="Factory" class="easyui-combobox" style="width: 120px; height: 22px" data-options='editable:false'/></td>
                    <td>批次优先级:</td>
                    <td><input id="Text4" name="Factory" class="easyui-combobox" style="width: 120px; height: 22px" data-options='editable:false'/></td>
                    <td>批次计划开始:</td>
                    <td><input id="plans" name="Factory" class="easyui-datebox" style="width: 120px; height: 22px" data-options='editable:false'/></td>
                    <td>手动指定开始:</td>
                    <td><input id="Text5" name="Factory" class="easyui-datebox" style="width: 120px; height: 22px" data-options='editable:false'/></td>
                    <td rowspan="2"><a href="javascript:void(0)" class="easyui-linkbutton not-custom l-btn2" style="width:60px" onclick="page.searchData()">查询</a></td>
	    			<td rowspan="2"><a href="javascript:void(0)" class="easyui-linkbutton not-custom l-btn2" style="width:60px" onclick="page.searchReset()">重置</a></td>
                </tr>
	    		<tr>
                    <td>批次号 :</td>
                    <td><input id="Text6" name="Factory" class="easyui-textbox" style="width: 120px; height: 22px" /></td>
                    <td>订单号:</td>
                    <td><input id="Text7" name="Factory" class="easyui-textbox" style="width: 120px; height: 22px" /></td>
                    <td>是否齐套:</td>
                    <td><input id="Text8" name="Factory" class="easyui-combobox" style="width: 120px; height: 22px" data-options='editable:false'/></td>
                    <td></td>
                    <td></td>
                    <td>批次计划完成:</td>
                    <td><input id="Text10" name="Factory" class="easyui-datebox" style="width: 120px; height: 22px" data-options='editable:false'/></td>
                    <td>追赶计划完成:</td>
                    <td><input id="Text11" name="Factory" class="easyui-datebox" style="width: 120px; height: 22px" data-options='editable:false'/></td>
	    		</tr>
	    	</table>
	    </form>
        </div> 
    </div>

    <div class="panelSection">    
        <div class="easyui-panel " title="查询结果" style="padding:3px;width: 100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
            <div id="ApsTestlayout" class="easyui-layout" style="height:390px" >
                 <div data-options="region:'center'" id="center" style="width:46%;" > 
                    <table id="ApsTest" style="height:380px;width:100%" data-options="rownumbers:true,fit:true,border:false,toolbar: '#tb'"></table>
                  </div>
                  <div data-options="region:'east',title:' '" style="width:54%;" id="east">
                    <div id="ApsTest1" style="height:360px;margin-top:-6px;"></div>
                </div>
            </div>
            <table id="ApsSpec" style="height:340px;" data-options="rownumbers:true,toolbar:'#tb1'"></table>
        </div>
    </div>
    <div id="tb" style="height:auto">
            <span style="display:"><input class="easyui-combogrid not-custom"  id="Apscolumns" style="width: 25px; height: 22px;" data-options="multiple:true"/></span> 
	</div>
    <div id="tb1" style="height:auto">
	   <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-reload'" onclick="page.returnContainer()">返回</a>
	</div>

    <div class="panelSection">    
        <div class="easyui-panel " title=" 设备能力分布" style="padding:3px;width: 100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
            <div id="Div1" class="easyui-layout" style="height:390px" >
                <div data-options="region:'center'" id="Div2" style="width:40%;text-align: center;" > 
                    <div style="padding:10px 0">
                        <span style="margin-right: 10px">设备编号</span><input id="Text9" class="easyui-textbox" style="width: 230px; height: 22px; "/>
                        <span style="margin-right: 10px">设备名称</span><input id="Text12" class="easyui-textbox" style="width: 230px; height: 22px; "/>
                    </div>
                    <div style="display:inline-block;width:90%;" id="EQULIST">
                    </div>
                </div>
                <div data-options="region:'east',collapsible:false" style="width:54%;" id="Div3">
                    <div style="border:1px solid #ddd;border-radius:5px;height: 30px;line-height: 30px;margin: 10px;padding: 0 10px">20003241245  设备名称 设备型号  |   班次：AA工区正常班 （7人）  |   30天负荷详情：96.6/120=80.50%</div>
                    <div id="initEChar" style="width: 100%;height:330px;float:left;"></div>
                </div>
            </div>
        </div>
     </div>
     <!--信息提示区域-->
     <div id="statusMessage" style="font-size: 14px; height: 40px"></div>
</body>
</html>
<script src="/InSiteWebApplication/Scripts/json2.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/array.pollyfill.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/dayjs.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/echarts.min.js" type="text/javascript"></script>

<script src="/InSiteWebApplication/Scripts/CustomPageJs/ReferenceJsLib.js" type="text/javascript"></script>
<script type="text/javascript" src="/InSiteWebApplication/Content/AnyGantt/zh-cn.js"></script>
<script type="text/javascript" src="/InSiteWebApplication/Content/AnyGantt/anychart-base.min.js"></script>
<script type="text/javascript" src="/InSiteWebApplication/Content/AnyGantt/anychart-ui.min.js"></script>
<script type="text/javascript" src="/InSiteWebApplication/Content/AnyGantt/anychart-exports.min.js"></script>
<script type="text/javascript" src="/InSiteWebApplication/Content/AnyGantt/anychart-gantt.min.js"></script>
<script type="text/javascript" src="/InSiteWebApplication/Content/AnyGantt/anychart-data-adapter.min.js"></script>
<script>
    //创建人：longb
    //日期：2023-08-07
    //描述：生产作业平衡
    var page = {
        rootPath: getRootPath(), //网站根路径
        chart:null,
        ajaxUrl: getRootPath() + "/Ashx/ApsHandler/ApsWorkStationHandler.ashx",
        init: function () {
            $('#plans').datebox('setValue', dayjs().startOf('month').format('YYYY-MM-DD'));
            $('#plane').datebox('setValue', dayjs().endOf('month').format('YYYY-MM-DD'));
            page.bind();
            page.initData();
            page.initEqu();
            page.initEChar();
        },
        //页面事件绑定
        bind: function () {
            var columns = [];
            var Spancolumns=[];
            var specColumns = [{ field: 'SPECNO', title: '工序号', width: 60, align: 'center' },
                 { field: 'SPECNAME', title: '工序名称', width: 90, align: 'center' },
                 { field: 'SPECTYPE', title: '工序类型', width: 80, align: 'center' },
                 { field: 'EQU', title: '设备', width: 80, align: 'center' },
                 { field: 'PLANSTART', title: '计划开始', width: 100, align: 'center' },
                 { field: 'PLANEND', title: '计划完成', width: 100, align: 'center' },
                 { field: 'PLANTIME', title: '持续时间（H）', width: 90, align: 'center' },
                 { field: 'PREPARECYCLE', title: '准备时间（min）', width: 100, align: 'center' },
                 { field: 'MAKECYCLE', title: '加工时间（min）', width: 100, align: 'center' },
                 { field: 'TRANSFERCYCLE', title: '转运时间（H）', width: 90, align: 'center' },
                 { field: 'COMMICYCLE', title: '外委周期', width: 70, align: 'center' }
                 ];
            for (var i = 1; i <= 29; i++) {
                specColumns.push({ field: 'day' + i, title: i, width: 30, align: 'center', formatter: function (value, row, index) { var day = Number(this.field.replace('day', '')); if (row.DAYS <= day && row.DAYE >= day) { return '<div style="background-color: #ffee00;height: 15px;width:30px;"></div>'; } } });
            }
            var Apscolumns=[{ field: 'CONTAINER', title: '批次号',width: 120,formatter: function (value, row, index) { return '<a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.SelectContainer(\'' + value + '\')">' + value + '</a>'; } },
                 { field: 'WORKFLOWNERSION', title: '工艺版本', width: 120, align: 'center'  },
                 { field: 'WORKFLOWSTEP', title: '当前工序', width: 120, align: 'center'  },
                 { field: 'ISCOMP', title: '生产准备齐套', width: 110, align: 'center'  },
                 { field: 'WORKCENTER', title: '当前工区', width: 100, align: 'center'  },
                 { field: 'PLANSTART', title: '计划开始', width: 100, align: 'center'  },
                 { field: 'PLANEND', title: '计划完成', width: 100, align: 'center' }];
             //排产左侧表格
            $('#ApsTest').datagrid({
                singleSelect: true,
                frozenColumns: [[{ field:'X', title: '预警',width: 80,align: 'center',rowspan:3}],[],[]],
                columns: [Apscolumns],
                onSelect: function (index, row) {
                },
                onLoadSuccess: function (data) {
                 
                }
            });
           //排产左侧表格--列筛选-显示隐藏
           $('#Apscolumns').combogrid({
                data: Apscolumns,
                panelWidth: 160,
                idField: 'field',
                textField: 'title',
                columns: [[{field:'field',title:'ID',width:80,checkbox:true},
				{field:'title',title:'列名',width:120},]],
                onSelect: function (index,row) {
                    $('#ApsTest').datagrid('showColumn',row.field);
                    var values=$('#Apscolumns').combobox('getValues');
                   Apscolumns.forEach(function (item) {
                        var isExist = values.some(function (i) {
                             return i === item.field
                        });
                        if(!isExist&&item.field!=row.field){$('#ApsTest').datagrid('hideColumn',item.field);}
                        });
                },
                onUnselect: function (index,row) {
                    var values=$('#Apscolumns').combobox('getValues'); 
                    $.each(Apscolumns,function(index,item){
                        if(item.field==row.field){ $('#ApsTest').datagrid('showColumn',row.field);}else{ $('#ApsTest').datagrid('hideColumn',row.field);}
                    });
                },
                onChange:function(newValue, oldValue){
                    if(newValue.length==0||newValue.length==Apscolumns.length){
                        $.each(Apscolumns,function(index,item){
                            $('#ApsTest').datagrid('showColumn',item.field);
                        });
                    }
                }
            });
            //排产明细
           $('#ApsSpec').datagrid({
                singleSelect: true,
                frozenColumns: [[{ field: 'XX', title: '操作', width: 80}]],
                columns: [specColumns],
                onSelect: function (index, row) {
                },
                onClickCell: function (index, field, value) {
                }
            });

        },
        initData: function () {
            var data = [{ CONTAINER: 'xxx-2023-01', WORKFLOWNERSION: 'XXX-MM:01', WORKFLOWSTEP: '005-工序', ISCOMP: '是', WORKCENTER: 'XX工区', PLANSTART: '2023-08-02', PLANEND: '2023-08-03', DAYS: 7, DAYE: 20,name:'xxxxx-2222',periods:[{end: "2023/8/2 9:00:00",fill: "#5FB878",id: "xxx",start: "2023/8/2 8:00:00",text: "ZS2023-1802004"}] },
                { CONTAINER: 'xxx-2023-02', WORKFLOWNERSION: 'XXX-MM:02', WORKFLOWSTEP: '010-工序', ISCOMP: '否', WORKCENTER: 'YYY工区', PLANSTART: '2023-08-01', PLANEND: '2023-08-04', DAYS: 2, DAYE: 25 }
            ]
            for (var i = 0; i <= 10; i++) {
                data.push({ CONTAINER: 'xxx-2023-01' + i, WORKFLOWNERSION: 'XXX-MM:01', WORKFLOWSTEP: '005-工序', ISCOMP: '是', WORKCENTER: 'XX工区', PLANSTART: '2023-08-01', PLANEND: '2023-08-03', DAYS: 7, DAYE: 20,name:'ZS2023-1802004'+i,periods:[{end: "2023/8/2 10:41:00",fill: "#5FB878",id:i,start: "2023/8/2 8:30:00"}]});
            }

            $('#ApsTest').datagrid('loadData', data);
            //$('#ApsTest1').datagrid('loadData', data);
            anygantt.loadInfiniteCapacity(data);//甘特图数据加载
            var data1 = [{ SPECNO: '005', SPECNAME: '工序1', SPECTYPE: '一般序', EQU: 'XX-01', PLANSTART: '2023-08-07', PLANEND: '2023-08-31', PLANTIME: '20', PREPARECYCLE: '23', MAKECYCLE: '56', TRANSFERCYCLE: '50', COMMICYCLE: '2', DAYS: 1, DAYE: 5 },
                { SPECNO: '010', SPECNAME: '工序', SPECTYPE: '一般序', EQU: 'XX-01', PLANSTART: '2023-08-07', PLANEND: '2023-08-31', PLANTIME: '20', PREPARECYCLE: '23', MAKECYCLE: '56', TRANSFERCYCLE: '50', COMMICYCLE: '2', DAYS: 6, DAYE: 10 },
                { SPECNO: '015', SPECNAME: '工序2', SPECTYPE: '检验序', EQU: 'XX-01', PLANSTART: '2023-08-07', PLANEND: '2023-08-31', PLANTIME: '20', PREPARECYCLE: '23', MAKECYCLE: '56', TRANSFERCYCLE: '50', COMMICYCLE: '2', DAYS: 11, DAYE: 17 },
                { SPECNO: '020', SPECNAME: '工序3', SPECTYPE: '一般序', EQU: 'XX-01', PLANSTART: '2023-08-07', PLANEND: '2023-08-31', PLANTIME: '20', PREPARECYCLE: '23', MAKECYCLE: '56', TRANSFERCYCLE: '50', COMMICYCLE: '2', DAYS: 18, DAYE: 23 },
                { SPECNO: '025', SPECNAME: '工序4', SPECTYPE: '一般序', EQU: 'XX-01', PLANSTART: '2023-08-07', PLANEND: '2023-08-31', PLANTIME: '20', PREPARECYCLE: '23', MAKECYCLE: '56', TRANSFERCYCLE: '50', COMMICYCLE: '2', DAYS: 24, DAYE: 26 },
                { SPECNO: '030', SPECNAME: '工序5', SPECTYPE: '一般序', EQU: 'XX-01', PLANSTART: '2023-08-07', PLANEND: '2023-08-31', PLANTIME: '20', PREPARECYCLE: '23', MAKECYCLE: '56', TRANSFERCYCLE: '50', COMMICYCLE: '2', DAYS: 27, DAYE: 30 },
            ]
            $('#ApsSpec').datagrid('loadData', data1);
            $('#ApsSpec').datagrid('getPanel').hide();
        },
        //批次排产选择隐藏，显示工序排产
        SelectContainer: function (obj) {
            $('#ApsSpec').datagrid('getPanel').show("slow");
            $('#ApsTestlayout').hide("slow");
        },
        //工序排产隐藏，显示批次排产
        returnContainer: function () {
            $('#ApsTestlayout').show("slow");
            $('#ApsSpec').datagrid('getPanel').hide("slow");
        },

        initEqu:function(){
            var html='<div class="equ">'+
                            '<div style="width: 100%;display: inline-block;line-height: 30px;">'+
                                '<div style="text-align: center;font-family: fantasy;width:50px;float:left">1</div><div style="font-family: fantasy;float:left">20003241245  设备名称 设备型号 BLABLA</div>'+
                            '</div>'+
                            '<div>'+
                                '<div style="height:49px;width:50px;background:rgb(216, 0, 27);margin-right: 10px;border-bottom-left-radius:5px;padding-top: 14px;float:left">124%</div>'+
                                '<div style="float:left;line-height: 24px;">'+
                                    '<div><div style="text-align: left;width:400px;float:left">日历：X分厂标准日历</div><div style="float:left">虚拟：否</div></div>'+
                                    '<div><div style="text-align: left;width:400px;float:left">班次：AA工区正常班（8h30min）</div><div style="float:left">人员：7</div></div>'+
                                '</div>'+
                            '</div>'+
                        '</div>'
            var html1="";
            for(var i=0;i<=5;i++){
                html1+=html;
            }
            $('#EQULIST').html(html1);
        },
        initEChar:function(){
            var myChart = echarts.init(document.getElementById('initEChar'));
            var xdata=[];
            for(var i=1;i<=30;i++){
                xdata.push(i);
            }
            var option = {
                      tooltip: {
                        trigger: 'axis',
                        axisPointer: {
                          type: 'shadow'
                        }
                      },
                      color:['#409EFF','orange','#F56C6C'],
                      legend: {},
                      grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                      },
                      xAxis: [
                        {
                          type: 'category',
                          data:xdata 
                        }
                      ],
                      yAxis: [
                        {
                          type: 'value'
                        }
                      ],
                      series: [
                        {
                          name: '生产',
                          type: 'bar',
                          stack: 'Ad',
                          emphasis: {
                            focus: 'series'
                          },
                          data: [70, 132, 101, 134, 90, 130, 110,100]
                        },
                        {
                          name: '闲置',
                          type: 'bar',
                          stack: 'Ad',
                          emphasis: {
                            focus: 'series'
                          },
                          data: [20, , , , , 130, 110,0]
                        },
                        {
                          name: '超负荷',
                          type: 'bar',
                          stack: 'Ad',
                          emphasis: {
                            focus: 'series'
                          },
                          data: [50, 132, 101, 154, 190, 130, 110,20]
                        },
   
                      ]
                    };
            myChart.setOption(option);
        },
        //查询
        searchData: function () {
            page.bind();
            page.initData();
            clearMessage();
        },
        //查询重置
        searchReset: function () {
            $('#searchForm').form('clear');
            page.bind();
            clearMessage();
        },
        //清除方法，重要！！！
        reset: function (iscondition, isresult) {
            clearMessage();
        },

        //post数据
        post: function (param, async, callback) {
            $.ajax({
                type: "Post",
                url: page.ajaxUrl,
                data: param,
                cashe: false,
                async: async,
                dataType: "json",
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    callback(data);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    displayMessage(XMLHttpRequest.responseText, false);
                }
            });
        }
    }
    
    var anygantt={
        loadInfiniteCapacity: function (Gdata) { //无限产能加载方法
        $("#ApsTest1").empty();
            anychart.onDocumentReady(function () {

                //anychart.data.loadJsonFile(getRootPath() + "/Ashx/ApsHandler/ZSLimitedCapacityHandler.ashx" + "?action=getStepInfiniteAps&machine=&containerNo=&mfgorderName=ZS&planStartTime=&planEndTime=&status=2", function (result) {

                    anychart.format.outputLocale('zh-cn');
                    anychart.format.inputDateTimeFormat("yyyy/MM/dd HH:mm:ss");

//                    if(result.Result==false){
//                        displayMessage(result.Message, false);
//                        return;
//                    }
                    chart = anychart.ganttResource();
                    chart.dataGrid(false);//隐藏左侧列表
                   
                    if(Gdata==null){return;}
                    var data=Gdata;//JSON.parse(result.ReturnData);
                    //anygantt.returnData=JSON.parse(result.ReturnData);
                    //anygantt.ContainerData=result.DBTable;
                    //console.log(data);

                    var treeData = anychart.data.tree(data, 'as-table');

                    //anygantt.treeData=treeData;
                    // create resource gantt chart
                   
                    chart.defaultRowHeight(31);//设置行高度
                    //chart.headerHeight(105);//设置头部高度
                    chart.splitterPosition(0); //左边grid宽度
                    chart.data(treeData);

                    //设置列
                    var dataGrid = chart.dataGrid();
                    //dataGrid.backgroundFill('blue .4');//
                    //dataGrid.rowFill('red .2');//设置左侧表格行样式 透明度
                     //datagrid tooltips
                    dataGrid.tooltip().useHtml(true); 
                    //chart.getTimeline().baselineFill('#FFAB91')
                    var periods = chart.getTimeline().periods();

                    // set the height of periods
                    //periods.height(40);//设置甘特图条高度
                    // draw custom periods
                    //periods.rendering().drawer(anygantt.drawingFunction);

                    //图形块的label
                    var periodLabels =periods.labels();
                    periodLabels.enabled(true);
                    periodLabels.useHtml(true);
                    periodLabels.fontColor("#104d89");
                    periodLabels.fontWeight(600);
                    periodLabels.format(function() {
                        let customData=this.period.customData;
                        if(customData!=null){
                            if(customData.isHolidate!=null&&customData.isHolidate=='1'){
                                var text='<span style="color:#fff;font-wieght:bold">'+this.period.text+'</span>';
                                return text;     
                            }
                        }
                    });
                    console.info(chart.getTimeline())
                    //chart.getTimeline().constructor.("#eeefff")
                    // configure tooltips of the timeline
                chart.getTimeline().tooltip().useHtml(true);
                chart.getTimeline().tooltip().format(function() {
                      var period=this.period;
                      var numChildren = this.item.numChildren();
                      var startDate = anychart.format.dateTime(this.start, "yyyy-MM-dd HH:mm:ss");
                      var endDate = anychart.format.dateTime(this.end, "yyyy-MM-dd HH:mm:ss");
                      var parentText ="<span style='font-weight:600;font-size:12pt'>" + 
                                     '开始:'+startDate + "<br>"+
                                     '结束:'+endDate+"</span>"
                      var childText ="<span style='font-weight:600;font-size:12pt'>" + 
                                     '开始:'+startDate + "<br>"+
                                     '结束:'+endDate+"</span>"
                      if (numChildren > 0) {
                        return parentText;
                      } else {
                        return childText;
                      }

                });

                    chart.getTimeline().edit(true);
                    chart.contextMenu(false);//禁用右键
                    chart.container('ApsTest1');
                    chart.draw();
                    chart.fitAll();
                    chart.autoRedraw(true);

                    
                    page.chart=chart;

                    //滚动到指定位置 add:wangjh
                    
                    //chart.scrollTo(top);
                    //chart.scrollTo(50);
                    //chart.scrollToRow(4);
                    //chart.scrollToEnd(4);                                       
                     
                    //隐藏甘特图轮动条
                    $("#ac_layer_3w").css("display","none");
                    $("#ac_layer_1v path").attr("fill","#c7def4");
                });
            //});

            //
            
        }
    }
    
    $(function () {
        page.init();

        //甘特图区域滚动事件监听 add:wangjh scroll  mousewheel DOMMouseScroll
        $('#ApsTest1').on("mousewheel DOMMouseScroll", function (event) {
            var delta = (event.originalEvent.wheelDelta && (event.originalEvent.wheelDelta > 0 ? 1 : -1)) ||  // chrome & ie
                        (event.originalEvent.detail && (event.originalEvent.detail > 0 ? -1 : 1));              // firefox
            var deltaData=event.originalEvent.wheelDelta;
            $('#center .datagrid-body').scrollTop($('#center .datagrid-body').scrollTop()-deltaData);
        });
        // easyui datagrid 区域滚动事件监听
       $('#center .datagrid-body:eq(0)').scroll(function () {
           var  chart = anychart.ganttResource();
           page.chart.scrollTo(this.scrollTop);
        })
    });
</script>
